<html>
<head><meta charset="utf-8"><title>MCP: pub(macro) lang-team#59 · t-lang/major changes · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/index.html">t-lang/major changes</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/MCP.3A.20pub(macro).20lang-team.2359.html">MCP: pub(macro) lang-team#59</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212581672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/MCP%3A%20pub%28macro%29%20lang-team%2359/near/212581672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/MCP.3A.20pub(macro).20lang-team.2359.html#212581672">(Oct 07 2020 at 16:08)</a>:</h4>
<p>A new proposal has been announced: <a href="https://github.com/rust-lang/lang-team/issues/59">MCP: pub(macro) #59</a>. It will be announced at the next meeting to try and draw attention to it, but usually MCPs are not discussed during triage meetings. If you think this would benefit from discussion amongst the team, consider proposing a design meeting.</p>



<a name="212584366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/MCP%3A%20pub%28macro%29%20lang-team%2359/near/212584366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/MCP.3A.20pub(macro).20lang-team.2359.html#212584366">(Oct 07 2020 at 16:28)</a>:</h4>
<p>This seems great to me.</p>



<a name="212586117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/MCP%3A%20pub%28macro%29%20lang-team%2359/near/212586117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/MCP.3A.20pub(macro).20lang-team.2359.html#212586117">(Oct 07 2020 at 16:43)</a>:</h4>
<p>In the other discussion thread, I wondered if long-term it'd make sense for hygienic macros to be able to access any crate-internal functions that would be available at the site of the macro definition. But thinking about it more, I <em>do</em> think it might make sense to mark such functions explicitly.</p>



<a name="212586130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/MCP%3A%20pub%28macro%29%20lang-team%2359/near/212586130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/MCP.3A.20pub(macro).20lang-team.2359.html#212586130">(Oct 07 2020 at 16:43)</a>:</h4>
<p>So I'm entirely in favor of this, if it can be implemented.</p>



<a name="212625840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/MCP%3A%20pub%28macro%29%20lang-team%2359/near/212625840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/MCP.3A.20pub(macro).20lang-team.2359.html#212625840">(Oct 07 2020 at 22:14)</a>:</h4>
<p>I'm pretty skeptical about this.</p>
<ul>
<li>This looks like an ad hoc addition that is going to be a technical debt.</li>
<li>The syntax looks out of place, <code>pub(macro)</code> is not a visibility as it exists in the language now, it's some property that exists additionally to regular visibility.</li>
<li>I suspect that the implementation will involve implementing the same hygiene 2.0 logic as the rest of unstable macros, so it's not going to be stabilized soon enough.</li>
<li>Even with hygiene 2.0 it's an open question whether the items produced by cross-crate macros should be able to be private, because we need to keep at least some publicity indication to avoid marking all symbols as visible at link time. (Here something like <code>pub(macro)</code> can help actually, but it needs to work as a feature additional to regular visibility.)</li>
<li>I'm not sure how this is supposed to work exactly and what are the precise rules should be, need to think about this.</li>
</ul>



<a name="212640005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/MCP%3A%20pub%28macro%29%20lang-team%2359/near/212640005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/MCP.3A.20pub(macro).20lang-team.2359.html#212640005">(Oct 08 2020 at 01:46)</a>:</h4>
<p>I'm guessing <code>pub(macro)</code> would essentially imply <code>pub(crate)</code>?</p>



<a name="212640098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/MCP%3A%20pub%28macro%29%20lang-team%2359/near/212640098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/MCP.3A.20pub(macro).20lang-team.2359.html#212640098">(Oct 08 2020 at 01:49)</a>:</h4>
<blockquote>
<p>functions marked pub(macro) would become public to macros defined in the same crate</p>
</blockquote>
<p>.. so yeah, seems like it</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>